<?php

class getDomainName {
	//获取域名
	function getDomainName(){
		$domain=$_SERVER["SERVER_NAME"];
		switch($domain){
			case "taobao360.com":
			case "www.taobao360.com":
				$d = "taobao360";
				break;

			case "itaoba.com":
			case "www.itaoba.com":
				$d = "itaoba";
				break;

			case "jialairui.com":
			case "www.jialairui.com":
				$d = "jialairui";
				break;

			case "x5mm.com":
			case "www.x5mm.com":
				$d = "x5mm";
				break;	
			
			case "ximalu.com":
			case "www.ximalu.com":
				$d = "ximalu";
				break;
			case "mkang.com":
			case "www.mkang.com":
				$d = "mkang";
				break;
			default:
				$d ="default";
		}
		return $d;
	}
}


//判断访问者是不是百度搜索引擎
function isBaidu(){
	$user_agent = $_SERVER["HTTP_USER_AGENT"];
	if(strpos(strtolower($user_agent), 'baiduspider') !== false){
		return true;
	}
}

//将淘宝替换为百度有啊
function repBaidu($taobaoData){
	$baiduData = str_replace('淘宝','百度有啊',$taobaoData);
	$baiduData = str_replace('taobao','youa',$baiduData);
	return $baiduData;
}

//获取真实的id
function getNoiseCid($ncid){
	$noCid = explode("-",$ncid);
	$cid = end($noCid);
	return $cid;
}

//增加混淆数据
function addNoise($flag="iTao",$cid){
	return $flag."-".$cid;
}


//测试函数
function test(){
	return true;
}